package com.example.onlineeducation.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import androidx.paging.PagingData
import androidx.paging.cachedIn
import com.example.onlineeducation.base.BaseViewModel
import com.example.onlineeducation.data.entity.TopicEntity
import com.example.onlineeducation.data.model.ExamRecordListDataModel
import com.example.onlineeducation.repository.StudyRepository
import com.yc.jetpacklib.net.YcResult
import kotlinx.coroutines.flow.collectLatest

class WrongTopicLearningVM : BaseViewModel() {
    private val mStudyRepository: StudyRepository by lazy { StudyRepository(mApiService) }


    private val _mErrorListDataModel = MutableLiveData<YcResult<List<TopicEntity>?>>()
    val mErrorListDataModel: LiveData<YcResult<List<TopicEntity>?>> = _mErrorListDataModel

    fun getErrorList(projectId: String) = ycLaunch {
        mStudyRepository.getErrorList(projectId).collectLatest {
            _mErrorListDataModel.postValue(it)
        }
    }

}
